<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ include file="/pages/login/common.jsp" %>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="B2B电商平台" name="description"/>
<meta content="B2B电商平台" name="keyword"/>

<title>B2B电商平台.店铺</title>
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/btn.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/themes.css" />
<link rel="stylesheet" href="<%=path%>/include/JQuery zTree v3.4/css/demo.css">
<link rel="stylesheet" href="<%=path%>/include/JQuery zTree v3.4/css/zTreeStyle/zTreeStyle.css">
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/register_icss.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/sweetalert/sweetalert.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/mmt_trading.css" />
<link rel="stylesheet" href="<%=path %>/include/JQuery ui/select2/css/select2.min.css" type="text/css"></link>

<script type="text/javascript" src="<%=path %>/include/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.common.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.shop.apply.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/cookies.js"></script>

<script type="text/javascript" src="<%=path%>/include/JQuery zTree v3.4/js/jquery.ztree.core-3.4.js"></script>
<script type="text/javascript" src="<%=path%>/include/JQuery zTree v3.4/js/jquery.ztree.excheck-3.4.js"></script>

<script type="text/javascript" src="<%=path %>/include/sweetalert/sweetalert.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/sweetalert/sweetalert-dev.js"></script>
<script type="text/javascript" src="<%=path %>/include/JQuery ui/select2/js/select2.min.js"></script>

	<link rel="stylesheet" href="<%=path%>/include/layui/css/layui.css"  media="all">
    <script type="text/javascript" src="<%=path %>/include/layui/lay/dest/layui.all.js" charset="utf-8"></script>
	
<style type="text/css">
body{}
table{border-collapse: collapse;}
tr{ 
    display:block; /*将tr设置为块体元素*/ 
    margin:10px;  /*设置tr间距为2px*/ 
}
td{height:30px; line-height:30px;}
.td1{
	width:100px;
	font-size:14px;
	text-align:right;
	vertical-align: middle;
}
#btnDiv a:hover{
   color:white;
}
button{
    width:44px;
    height:24px;
    line-height:24px;   
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: 0 -203px;
    border:0;
    cursor:pointer;
    font: 12px/1.5 arial,tahoma,\5b8b\4f53;
    margin: 0 0 0 5px;
    outline:none;
    background-image: url('<%=path%>/include/css/img/xs_bgx.png');   
}
.input1{
	width:200px;
	height:30px;
	line-height:30px;
	vertical-align:middle;
	float:left;
}
.select1{
	width: 196px;
    height: 30px;
}
.select2{
    height: 30px;
}
.acss:hover{
	background: #fff;
}
.promptBox{display:inline-block;height:30px;padding-left:5px;width:160px;white-space:nowrap; z-index:50; position:relative;}
.tips-errow{background-position:-296px -22px;color:#f52c2c;}
.tips-ok{background-position:-296px 14px;color:#666;}
.tipsCur{background-position:-296px -55px;color:#666;}
.approveDiv{float:right;color:blue;margin-right:10px;}
</style>
<script type="text/javascript">
	var approveStatus = '${approveStatus}';
//	var approveStatus = '1';
	$(function(){
		if(approveStatus == ''){
			$("#approveDiv").hide();
		}else if(approveStatus == 0){
			$("#approveDiv").html("审核状态：待审核");
			$("#btnDiv").hide();
			$('input,select,textarea',$('form[name="fm"]')).prop('readonly',true); 
		}else if(approveStatus == 1){
			$("#approveDiv").html("审核状态：审核通过");
			$("#btnDiv").hide();
			$('input,select,textarea',$('form[name="fm"]')).prop('readonly',true); 
		}else if(approveStatus == 2){
			$("#approveDiv").html("审核状态：审核不通过");
		}
	});

	function _checkAllReady(){
		var result = true;
		jQuery(".rightTd input").each(function(index){
			if(jQuery(this).val()=="" && (jQuery(this).attr("name")=="citySel" || jQuery(this).attr("name")=="shopArea") ){
				result = false;
				jQuery(this).nextAll("div").find(".tips-ok").hide();
				jQuery(this).nextAll("div").find(".tips-errow").hide();
				jQuery(this).nextAll("div").find(".tipsCur").show();
			}
			if(this.name!='file'){
				if(jQuery(this).val()=="" && jQuery(this).attr("name")!="idcardF" 
						&& jQuery(this).attr("name")!="idcardB" && jQuery(this).attr("name")!="businessLicense"){
					result = false;
					jQuery(this).next("div").find(".tips-ok").hide();
					jQuery(this).next("div").find(".tips-errow").hide();
					jQuery(this).next("div").find(".tipsCur").show();
				}else if(jQuery(this).val()=="" && jQuery(this).attr("name")!="idcardF" 
						&& jQuery(this).attr("name")!="idcardB" && jQuery(this).attr("name")!="businessLicense"){
					console.log(33);
					result = false;
					jQuery(this).parent().nextAll().find(".tips-ok").hide();
					jQuery(this).parent().nextAll().find(".tips-errow").hide();
					jQuery(this).parent().nextAll().find(".tipsCur").show();
				}
			}
		});
		jQuery(".rightTd textarea").each(function(index){
			if(jQuery(this).val()==""){
				result = false;
				jQuery(this).next("div").find(".tips-ok").hide();
				jQuery(this).next("div").find(".tips-errow").hide();
				jQuery(this).next("div").find(".tipsCur").show();
			}
		});
		jQuery(".rightTd select").each(function(index){
			if(jQuery(this).val()==""){
				result = false;
				jQuery(this).nextAll("div").find(".tips-ok").hide();
				jQuery(this).nextAll("div").find(".tips-errow").hide();
				jQuery(this).nextAll("div").find(".tipsCur").show();
			}
		});
		return result;
	}
	
	function saveShop(){
		var checked = $("#statement").is(':checked');
		if(!checked){
			parent.swal("请勾选徽映优选供应商入驻协议");
			return;
		}
		if(_checkAllReady()){
			$.ajax({
	              cache: true,
	              type: "POST",
	              url:'<%=path%>/shopApply/saveShop.do',
	              data:$('#fm').serialize(),
	              async: false,
	              error: function(request) {
	            //     $.messager.alert('消息提醒','提交失败!');  	
	                 parent.swal("", "提交失败!", "error");
	              },
	              success: function(data) {
					data = eval('(' + data + ')');
					var msg = data.msg;
	                   if(data.success){
						parent.swal("", msg, "success");
	                    window.location.href = '<%=path %>/shopManage/toShopInfo.do';
					}else {
						parent.swal("", msg, "error");
					}
	              }
	         });
		}
	}
	function _changeProvince(obj){
		var areaCode = $('#ProvinceCode option:selected').val();
		var ifzxs = $('#ProvinceCode option:selected').attr('class');
		if(ifzxs=="0"){
			$.ajax({
	              cache: true,
	              type: "POST",
	              url:'<%=path%>/shopApply/queryAreaList.do',
	              data:{areaPcode : areaCode,level : "3"},
	              async: false,
	              dataType : 'json',
	              error: function(request) {
	              },
	              success: function(data) {
	              	 if(data.success){
	              	 	var list = data.obj;
	              	 	if(list.length>0){
							$("#cityCode").empty();
							for(var i =0 ;i<list.length;i++){
								var info = list[i];
								console.info(info);
								var AREA_CODE = info.AREA_CODE;
								var AREA_NAME = info.AREA_NAME;
								var AREA_PCODE = info.AREA_PCODE;
								var IF_ZXS = info.IF_ZXS;
								if(areaCode==AREA_PCODE){
									$("#cityCode").append("<option value='"+AREA_CODE+"'>"+AREA_NAME+"</option>");
								}
							}
							$("#cityCode").show();
						}
	              	 }
	              }
	        })
			
		}
	}

	function _changePro(obj,id,level){
		if(obj.value==""){
			$("#"+id).empty();
			$("#"+id).hide();
			$("#shopCounty").empty();
			$("#shopCounty").hide();
			return;
		}
		$.ajax({
              cache: true,
              type: "POST",
              url:'<%=path%>/shopApply/queryAreaList1.do',
              data:{areaPcode : obj.value,level:level},
              async: false,
              dataType : 'json',
              error: function(request) {
              },
              success: function(data) {
              	 if(data.success){
              	 	var list = data.obj;
              	 	if(list.length>0){
						$("#"+id).empty();
						$("#shopCounty").empty();
						$("#shopCounty").hide();
						for(var i =0 ;i<list.length;i++){
							var info = list[i];
							var AREA_NAME = info.AREA_NAME;
							var AREA_CODE = info.AREA_CODE;
							$("#"+id).append("<option value='"+AREA_CODE+"'>"+AREA_NAME+"</option>");
						}
						$("#"+id).show();
					}
              	 }
              }
        });
	}

	function _statementInfo(){
		$(window.parent.document).find("#rightFrame").height(600);
    	//var url = "<%=path%>/shopApply/toStatementPage.do";
    	var url = "<%=path%>/pages/shop/statement.jsp";
    	parent.layer.open({
  			title: '',
  			type: 2, 
  			area: ['800px', '500px'],
  			content: [url,'no'], //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: [url, 'no']
  			end:function(){
  				_reHeight();
  				$("#statement").attr("checked",'true');
  			}
		});
    }
	
	
</script>
</head>
<body style="font-family: '微软雅黑'">
	<div id="contentDiv" style="padding:5px; width:99%;margin: 0px;">
		<div style="width:100%;height:30px;border-bottom:1px solid #ADADAD;">
			<div class="toptil">开店申请</div>
	 		<div id="approveDiv" class="approveDiv">
	 		</div>
		</div>
		<form id="fm" name="fm" class="form-horizontal form-validate" method="post" action="" novalidate="novalidate">
			<input type="hidden" id="approveStatus" name="approveStatus" value="${approveStatus}">
			<input type="hidden" id="shopId" name="shopId" value="${shopMap.SHOP_ID }">
			<input type="hidden" id="curPath" name="curPath" value="<%=path %>">
			<div style="width:100%;margin-top:20px;margin-left:10px;">
				<table style="width:100%;">
					<tr>
						<td class="td1" nowrap>店铺名称：</td>
						<td class="rightTd" nowrap>
							<input class="input1" id="shopName" name="shopName" value="${shopMap.SHOP_NAME }">
							<div class="promptBox">
	                       		<div class='tips-errow' style="display:none;">店铺名称已存在</div>
	                       		<div class='tips-ok' style="display:none;"></div>
	                       		<div class='tipsCur' style="display:none;">请输入店铺名称</div>
	                       	</div>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>法人姓名：</td>
						<td class="rightTd" nowrap>
							<input class="input1" id="legalPerson" name="legalPerson" value="${shopMap.LEGAL_PERSON }">
							<div class="promptBox">
	                       		<div class='tips-errow' style="display:none;">法人姓名已存在</div>
	                       		<div class='tips-ok' style="display:none;"></div>
	                       		<div class='tipsCur' style="display:none;">请输入法人姓名</div>
	                       	</div>
						</td>
					</tr>
					<tr>
						<td class="td1" style="vertical-align:top;white-space: nowrap;">店铺地址：</td>
						<td class="rightTd">
							<select class="select2" id="shopProvince" name="shopProvince" onchange="_changePro(this,'shopCity','3')">
								<option value=""  >---请选择---</option>
								<c:forEach items="${provinceList}" var="province" > 
									<option value="${province.AREA_CODE }" <c:if test="${province.AREA_CODE eq shopMap.SHOP_PROVINCE}">selected="selected"</c:if>>${province.AREA_NAME }</option>
								</c:forEach>
							</select>
							<select class="select2" id="shopCity" name="shopCity" style="display:none;"  onchange="_changePro(this,'shopCounty','4')">
								<c:forEach items="${cityList}" var="city" > 
									<option value="${city.AREA_CODE }" <c:if test="${city.AREA_CODE eq shopMap.SHOP_CITY}">selected="selected"</c:if>>${city.AREA_NAME }</option>
								</c:forEach>
							</select>
							<select class="select2" id="shopCounty" name="shopCounty" style="display:none;">
								<c:forEach items="${countyList}" var="county" > 
									<option value="${county.AREA_CODE }" <c:if test="${county.AREA_CODE eq shopMap.SHOP_COUNTY}">selected="selected"</c:if>>${county.AREA_NAME }</option>
								</c:forEach>
							</select>
						</td>
					</tr>
					<tr>
						<td class="td1" style="vertical-align:top;white-space: nowrap;">详细地址：</td>
						<td class="rightTd" nowrap>
							<input class="input1" id="shopAddr" name="shopAddr" value="${shopMap.SHOP_ADDRESS }">
							<div class="promptBox">
		                   		<div class='tips-errow' style="display:none;">请输入详细地址</div>
		                   		<div class='tips-ok' style="display:none;"></div>
		                   		<div class='tipsCur' style="display:none;">请输入详细地址</div>
		                   	</div>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>店铺电话：</td>
						<td class="rightTd" nowrap>
							<input class="input1" id="shopTel" name="shopTel" value="${shopMap.SHOP_TEL }">
							<div class="promptBox">
		                   		<div class='tips-errow' style="display:none;">请输入店铺电话</div>
		                   		<div class='tips-ok' style="display:none;"></div>
		                   		<div class='tipsCur' style="display:none;">请输入店铺电话</div>
		                   	</div>	
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;width:100px;">店铺详情：</td>
						<td class="rightTd" nowrap>
							<textarea id="shopDesc" name="shopDesc" style="width: 400px; height: 80px; resize: none;">${shopMap.SHOP_DESC }</textarea>
							<div class="promptBox">
		                   		<div class='tips-errow' style="display:none;">请输入店铺详情</div>
		                   		<div class='tips-ok' style="display:none;"></div>
		                   		<div class='tipsCur' style="display:none;">请输入店铺详情</div>
		                   	</div>	
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">经营区域：</td>
						<td class="rightTd" nowrap>
							<textarea id="citySel" name="citySel" readonly style="width: 400px; height: 80px; resize: none;" onclick="showMenu();">${areaName}</textarea>
							<input type="hidden" id="shopArea" name="shopArea" value="${areaCode}">
							<div id="menuContent" class="menuContent" style="display:none; position: absolute;z-index:99;">
								<ul id="treeDemo" class="ztree" style="margin-top:0; width:400px;height:230px;"></ul>
							</div>
							<div class="promptBox">
		                   		<div class='tips-errow' style="display:none;">请选择经营区域</div>
		                   		<div class='tips-ok' style="display:none;"></div>
		                   		<div class='tipsCur' style="display:none;">请选择经营区域</div>
		                   	</div>
						</td>
					</tr>
					<tr>
						<td class="td1"  nowrap style="vertical-align:top;">身份证：</td>
						<td class="rightTd" id="td1" nowrap>
							<div id="idcardDiv" style=";float:left;margin-right:10px;text-align:center;">
								<div id="imgDiv1" style="margin-bottom:10px;">
									<img src="${shopMap.IDCARD_NO_PIC_F }"
										id="imgView1" style="height: 75px; width: 100px;">
								</div>
								<div id="file1" class="site-demo-upbar" style="">
								    <input type="file" name="file" class="layui-upload-file" id="img1">
								</div>
								<input id="idcardF" name="idcardF" type="hidden" value="${shopMap.IDCARD_NO_PIC_F }">
							</div>
							<div style="float:left;text-align:center;">
								<div id="imgDiv2" style="margin-bottom:10px;">
									<img src="${shopMap.IDCARD_NO_PIC_B }"
										id="imgView2" style="height: 75px; width: 100px;">
								</div>
								<div id="file1" class="site-demo-upbar" style="">
								    <input type="file" name="file" class="layui-upload-file" id="img2">
								</div>
								<input id="idcardB" name="idcardB" type="hidden" value="${shopMap.IDCARD_NO_PIC_B }">
							</div>
							<div class="promptBox">
		                   		<div class='tips-errow' style="display:none;">请上传身份证正/反面照片</div>
		                   		<div class='tips-ok' style="display:none;"></div>
		                   		<div class='tipsCur' style="display:none;">请上传身份证正/反面照片</div>
		                   	</div>	
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">店铺图片：</td>
						<td class="rightTd" nowrap style="vertical-align:top;">
							<div id="shopLogoDiv" style="float:left;margin-right:10px;text-align:center;">
								<div id="imgDiv3" style="margin-bottom:10px;">
									<img src="${shopMap.SHOP_LOGO }"
										id="imgView3" style="height: 75px; width: 100px;">
								</div>
								<div id="file1" class="site-demo-upbar" style="">
								    <input type="file" name="file" class="layui-upload-file" id="img3">
								</div>
								<input id="shopLogo" name="shopLogo" type="hidden" value="${shopMap.SHOP_LOGO }">
							</div>
							<div id="shopPicDiv" style="float:left;text-align:center;">
								<div id="imgDiv4" style="margin-bottom:10px;">
									<img src="${shopMap.SHOP_PIC }"
										id="imgView4" style="height: 75px; width: 100px;">
								</div>
								<div id="file1" class="site-demo-upbar" style="">
								    <input type="file" name="file" class="layui-upload-file" id="img4">
								</div>
								<input id="shopPic" name="shopPic" type="hidden" value="${shopMap.SHOP_PIC }">
							</div>
							<div class="promptBox">
		                   		<div class='tips-errow' style="display:none;">请上传店铺图片</div>
		                   		<div class='tips-ok' style="display:none;"></div>
		                   		<div class='tipsCur' style="display:none;">请上传店铺图片</div>
		                   	</div>	
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">营业执照：</td>
						<td class="rightTd" nowrap>
							<div id="businessLicenseDiv" style="float:left;text-align:center;">
								<div id="imgDiv5" style="margin-bottom:10px;">
									<img src="${shopMap.BUSINESS_LICENSE }"
										id="imgView5" style="height: 75px; width: 100px;">
								</div>
								<div id="file1" class="site-demo-upbar" style="">
								    <input type="file" name="file" class="layui-upload-file" id="img5">
								</div>
								<input id="businessLicense" name="businessLicense" type="hidden" value="${shopMap.BUSINESS_LICENSE }">
							</div>
							<div class="promptBox">
		                   		<div class='tips-errow' style="display:none;">请上传营业执照</div>
		                   		<div class='tips-ok' style="display:none;"></div>
		                   		<div class='tipsCur' style="display:none;">请上传营业执照</div>
		                   	</div>	
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;width:100px;">经营范围：</td>
						<td class="rightTd" nowrap>
							<textarea id="businessScope" name="businessScope" style="width: 400px; height: 80px; resize: none;">${shopMap.BUSINESS_SCOPE }</textarea>
							<div class="promptBox">
		                   		<div class='tips-errow' style="display:none;">请输入经营范围</div>
		                   		<div class='tips-ok' style="display:none;"></div>
		                   		<div class='tipsCur' style="display:none;">请输入经营范围</div>
		                   	</div>	
						</td>
						
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">支持在线支付：</td>
						<td class="rightTd" nowrap>
							<input type="radio" name="payOnline" value="1"  <c:if test="${shopMap.PAY_ONLINE ne '0' }">checked</c:if> />是
							<input type="radio" name="payOnline" value="0"  <c:if test="${shopMap.PAY_ONLINE eq '0' }">checked</c:if> />否
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>起送金额：</td>
						<td class="rightTd" nowrap>
							<input class="input1" id="startMoney" name="startMoney" value="${shopMap.START_MONEY }">
							<div class="promptBox">
	                       		<div class='tips-errow' style="display:none;">起送金额不符合</div>
	                       		<div class='tips-ok' style="display:none;"></div>
	                       		<div class='tipsCur' style="display:none;">请输入起送金额</div>
	                       	</div>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>开户银行：</td>
						<td class="rightTd" nowrap>
							<select class="select1" id="bankCode" name="bankCode">
							<option value="">---请选择---</option>
							<c:forEach items="${bankList}" var="bank" > 
							<c:if test="${bank.BANK_CODE eq shopMap.BANK_CODE }">
							<option value="<c:out value='${bank.BANK_CODE }'/>" SELECTED><c:out value='${bank.BANK_NAME }'/></option>
							</c:if>
							<c:if test="${bank.BANK_CODE ne shopMap.BANK_CODE }">
							<option value="<c:out value='${bank.BANK_CODE }'/>" ><c:out value='${bank.BANK_NAME }'/></option>
							</c:if>
							</c:forEach>
							</select>
							<div class="promptBox">
	                       		<div class='tips-errow' style="display:none;">开户银行已存在</div>
	                       		<div class='tips-ok' style="display:none;"></div>
	                       		<div class='tipsCur' style="display:none;">请选择开户银行</div>
	                       	</div>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>开户银行城市：</td>
						<td class="rightTd" nowrap>
							<select class="select2" id="ProvinceCode" name="ProvinceCode" onchange="_changeProvince(this)">
							<option value=""  >---请选择---</option>
							<c:forEach items="${provinceList}" var="province" > 
							<c:if test="${province.AREA_CODE eq shopMap.BANK_PROVINCE and province.LEVEL eq '2' }">
							<option value="<c:out value='${province.AREA_CODE }'/>" class="<c:out value='${province.IF_ZXS }'/>" SELECTED><c:out value='${province.AREA_NAME }'/></option>
							</c:if>
							<c:if test="${province.AREA_CODE ne shopMap.BANK_PROVINCE and province.LEVEL eq '2' }">
							<option value="<c:out value='${province.AREA_CODE }'/>" class="<c:out value='${province.IF_ZXS }'/>" ><c:out value='${province.AREA_NAME }'/></option>
							</c:if>
							</c:forEach>
							</select>
							<select class="select2" id="cityCode" name="cityCode" style="display:none;" >
							</select>
							<div class="promptBox">
	                       		<div class='tips-errow' style="display:none;">开户银行城市已存在</div>
	                       		<div class='tips-ok' style="display:none;"></div>
	                       		<div class='tipsCur' style="display:none;">请选择开户银行城市</div>
	                       	</div>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>开户人姓名：</td>
						<td class="rightTd" nowrap>
							<input class="input1" id="bankAccountName" name="bankAccountName" value="${shopMap.BANK_ACCOUNT_NAME }">
							<div class="promptBox">
	                       		<div class='tips-errow' style="display:none;">开户人姓名已存在</div>
	                       		<div class='tips-ok' style="display:none;"></div>
	                       		<div class='tipsCur' style="display:none;">请输入开户人姓名</div>
	                       	</div>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>对公账户：</td>
						<td class="rightTd" nowrap>
							<input class="input1" id="bankAccount" name="bankAccount" value="${shopMap.BANK_ACCOUNT }">
							<div class="promptBox">
	                       		<div class='tips-errow' style="display:none;">对公账户不符合规则</div>
	                       		<div class='tips-ok' style="display:none;"></div>
	                       		<div class='tipsCur' style="display:none;">请输入对公账户</div>
	                       	</div>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap><input type="checkbox" checked="checked" id="statement" name="statement" /> </td>
						<td class="rightTd" nowrap style="color: #999">
							已阅读并同意<a class="acss" onclick="_statementInfo()" style="color: #4b8cf7;">《徽映优选供应商入驻协议》</a>
						</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td style="">
							<div id="btnDiv">
								<a onclick="saveShop();" class="btn btn-primary" style="text-decoration:none;">提交</a>
							</div>
						</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
				</table>
			</div>
		</form>
	</div>
</body>
<script type="text/javascript">
layui.use('upload', function(){
	 layui.upload({
	  	url: '<%=path%>/upload/uploadPic'
	   	,elem: '#img1' //指定原始元素，默认直接查找class="layui-upload-file"
	    //,method: 'post' //上传接口的http类型
	    ,title:'正面照'
	    ,success: function(res){
			$("#idcardF").val(res.url);
			$("#imgView1").attr("src", res.url);
			if($.trim($("#idcardF").val()) != '' && $.trim($("#idcardB").val()) != ''){
				$("#idcardDiv").nextAll('div').find(".tips-errow").hide();
				$("#idcardDiv").nextAll('div').find(".tipsCur").hide();
				$("#idcardDiv").nextAll('div').find(".tips-ok").show();
			}
	    }
	 });
	 layui.upload({
	  	url: '<%=path%>/upload/uploadPic'
	   	,elem: '#img2' //指定原始元素，默认直接查找class="layui-upload-file"
	    //,method: 'post' //上传接口的http类型
	    ,title:'反面照'
	    ,success: function(res){
			$("#idcardB").val(res.url);
			$("#imgView2").attr("src", res.url);
			$("#idcardB").parent().nextAll().find(".tips-ok").hide();
			$("#idcardB").parent().nextAll().find(".tips-errow").hide();
			$("#idcardB").parent().nextAll().find(".tipsCur").show();
			if($.trim($("#idcardF").val()) != '' && $.trim($("#idcardB").val()) != ''){
					$("#idcardDiv").nextAll('div').find(".tips-errow").hide();
				$("#idcardDiv").nextAll('div').find(".tipsCur").hide();
				$("#idcardDiv").nextAll('div').find(".tips-ok").show();
				}
	    }
	 });
	 layui.upload({
	  	url: '<%=path%>/upload/uploadPic'
	   	,elem: '#img3' //指定原始元素，默认直接查找class="layui-upload-file"
	    //,method: 'post' //上传接口的http类型
	    ,title:'店铺logo'
	    ,success: function(res){
		 	$("#shopLogo").val(res.url);
			$("#imgView3").attr("src", res.url); 
			if($.trim($("#shopLogo").val()) != ''){
				$("#shopLogoDiv").nextAll('div').find(".tips-errow").hide();
				$("#shopLogoDiv").nextAll('div').find(".tipsCur").hide();
				$("#shopLogoDiv").nextAll('div').find(".tips-ok").show();
			}
	    }
	 });
	 layui.upload({
	  	url: '<%=path%>/upload/uploadPic'
	   	,elem: '#img4' //指定原始元素，默认直接查找class="layui-upload-file"
	    //,method: 'post' //上传接口的http类型
	    ,title:'宣传图片'
	    ,success: function(res){
	       	$("#shopPic").val(res.url);
			$("#imgView4").attr("src", res.url);
			if($.trim($("#shopPic").val()) != ''){
				$("#shopPicDiv").nextAll('div').find(".tips-errow").hide();
				$("#shopPicDiv").nextAll('div').find(".tipsCur").hide();
				$("#shopPicDiv").nextAll('div').find(".tips-ok").show();
			}
	    }
	 });
	 layui.upload({
	  	url: '<%=path%>/upload/uploadPic'
	   	,elem: '#img5' //指定原始元素，默认直接查找class="layui-upload-file"
	    //,method: 'post' //上传接口的http类型
	    ,title:'上传'
	    ,success: function(res){
		 	$("#businessLicense").val(res.url);
			$("#imgView5").attr("src", res.url);
			if($.trim($("#businessLicense").val()) != ''){
				$("#businessLicenseDiv").nextAll('div').find(".tips-errow").hide();
				$("#businessLicenseDiv").nextAll('div').find(".tipsCur").hide();
				$("#businessLicenseDiv").nextAll('div').find(".tips-ok").show();
			}
	    }
	 });
});
</script>
<script type="text/javascript">
	var zTree = null;
	$(document).ready(function(){
		_reHeight();
		zTree = $.fn.zTree.init($("#treeDemo"), treeSetting);
		$("#bankCode").select2();
	});
	function _reHeight(){
		var main = $(window.parent.document).find("#rightFrame");
		var mainheight = $("#contentDiv").height();
		main.height(mainheight);
	}
	
	/* 
	 * 下拉树的设置 
	 */  
	var treeSetting = {  
	    view: {  
	        dblClickExpand: false  
	    },  
		data: {  
			simpleData: {  
			    enable: true,
			    rootPId: 0
			}  
		},
		check: {  
			enable: true,
			autoCheckTrigger:true
		}, 
		async:{
			enable: true,//设置ztree是否开启异步加载模式
			showLine: true ,//设置是否显示连接线
			type: "post",//post方式请求数据
			url: getUrl,//数据请求url
			autoParam:["id","name"],//异步加载时需要自动提交父节点属性的参数
			otherParam:{"otherParam":"zTreeAsyncTest"},
			dataFilter: filter
		},
		callback: {
			beforeClick: beforeClick,
			onCheck: onCheck,
			onAsyncError : zTreeOnAsyncError,//加载失败
			onAsyncSuccess: zTreeOnAsyncSuccess//加载完成
		}
	}; 
	
	function getUrl(treeId, treeNode){
		var shopId = $("#shopId").val();
		var url = "<%=path %>/shopManage/getTree.do?shopId=" + shopId;
		return url;
	}
	
	function beforeClick(treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj("treeDemo");
		zTree.checkNode(treeNode, !treeNode.checked, null, true);
		return false;
	}
	
	/* 
	 * 点击事件 
	 */  
	function onCheck(e, treeId, treeNode) {  
		
		var cityObj = $("#citySel");
		var shopAreaObj = $("#shopArea");
	    var zTree = $.fn.zTree.getZTreeObj("treeDemo");
		var nodes = zTree.getCheckedNodes(true);
		var changeNodes = zTree.getChangeCheckedNodes();
		var v = '';
		var ids = '';
		for (var i=0, l=nodes.length; i<l; i++) {
			if(!nodes[i].isParent){
				v += nodes[i].aname + ",";
				ids += nodes[i].id + ",";
			}
		}
		if (v.length > 0 ) v = v.substring(0, v.length-1);
		if (ids.length > 0 ) ids = ids.substring(0, ids.length-1);
		cityObj.attr("value", v);
		shopAreaObj.attr("value", ids);
	}  
	//过滤函数  
    function filter(treeId, parentNode, childNodes) {  
        if (!childNodes)  
            return null;  
        for ( var i = 0, l = childNodes.length; i < l; i++) {  
            //childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');  
        }  
        return childNodes;  
    }  
    //加载完成
	var firstAsyncSuccessFlag = 0;
	function zTreeOnAsyncSuccess(event, treeId, msg) {
		if (firstAsyncSuccessFlag == 0) {
        	try {
				//调用默认展开第一个结点
			//	var nodes = zTree.getNodes();
			//	zTree.expandNode(nodes[0], true);
			//	for(var i = 0; i< nodes.length; i++){
			//		zTree.expandNode(nodes[i], true);
			//	}
			//	$("#treeDemo").click();
	            
	            //异步加载完成再折叠所有子节点
	            var nodes = zTree.getNodes();
				if (nodes.length>0) {
					var index = zTree.getNodeIndex(nodes[0]);
					for(var j=0; j<nodes.length; j++){
						var rootNode = nodes[j];
						zTree.expandNode(rootNode, false, true, null, true);
					}
				}
	            
	            firstAsyncSuccessFlag = 1;
        	} catch (err) {
	              
         	}
    	}
	}
	function hideMenu() {
		$("#menuContent").fadeOut("fast");
		$("body").unbind("mousedown", onBodyDown);
	}
	
	function onBodyDown(event) {
		if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
			hideMenu();
		}
	}
	
	function showMenu() {
		var cityObj = $("#citySel");
		var cityOffset = $("#citySel").offset();
		$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");
		$("body").bind("mousedown", onBodyDown);
	}
	//加载失败提示  
    function zTreeOnAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) {  
        parent.swal("", "经营区域加载失败，请稍后再试", "info");
    }; 
</script>
</html>
